<template>
	<view class="operation-bar">
		<view>
			<view class="choosed" @click="$emit('chooseAll')" v-if="!isAllChoosed">
				<image class="image" src="../../../static/img/cart/unchoosed.svg" alt="" />
				全选
			</view>
			<view class="choosed" @click="$emit('unChooseAll')" v-else>
				<image class="image" src="../../../static/img/cart/choosed.svg" alt="" />
				全选
			</view>
		</view>
		<view>
			<view class="btn" :class="ifChoosed" @click="$emit('resolve')">{{ desc }}</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "ItemOperationBar",
		props: {
			desc: {
				type: String,
				default () {
					return "";
				},
			},
			isAllChoosed: {
				type: Boolean,
				default () {
					return false;
				},
			},
			hasChoosed: {
				type: Boolean,
				default () {
					return false;
				},
			},
		},

		computed: {
			ifChoosed() {
				return this.hasChoosed ? "isChoosed" : ["noChoosed", "lock"];
			},

		},
	};
</script>
<style lang="scss" scoped>
	.operation-bar {
		height: 100rpx;
		margin: 0 auto;
		box-sizing: border-box;
		width: 100vw;
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 0.9rem;
		padding-left: 4vw;
		padding-right: 3vw;
		position: fixed;
		z-index: 5;
		bottom: 0;
		background-color: white;
	}

	.choosed {
		display: flex;
		align-items: center;
		/* #ifdef H5 */
		gap: 4rpx;
		/* #endif */
	}

	.choosed > .image {
		height: 42rpx;
		width: 42rpx;
	}

	.btn {
		border: 2rpx solid rgb(224, 224, 224);
		padding: 12rpx 20rpx;
		border-radius: 30rpx;
		text-align: center;
		margin: 0 20rpx;
		line-height: 4vh;
		color: white;
		border: none;

	}

	.isChoosed {
		background-color: #f4200c;
	}

	.noChoosed {
		background-color: #f57469;
	}

	.lock {
		pointer-events: none;
	}
</style>
